<?php 
include_once("config.php");
$valid_users = array_keys($valid_passwords);
$user = $_SERVER['PHP_AUTH_USER'];
$pass = $_SERVER['PHP_AUTH_PW'];
$validated = (in_array($user, $valid_users)) && ($pass == $valid_passwords[$user]);
if (!$validated) {
	header('WWW-Authenticate: Basic realm="My Realm"');
	header('HTTP/1.0 401 Unauthorized');
	die ("Not authorized");
}


if (isset($_GET['p'])) {
	$page=$_GET['p'];
}else{
	$page=1;
}
$pageSize=10;
$mysqli = new mysqli($dbhost, $dbuser, $dbpwd, $dbName);
if (!$mysqli->set_charset("utf8mb4")) {printf("Error loading character set utf8: %s\n", $mysqli->error);}
if (isset($_GET['id']) && !empty($_GET['id'])) {
	$del_id=$_GET['id'];
	$mysqli->query("delete from users  where id='".$del_id."' ");
	$query_hao=$mysqli->query("select name,id from hao where id='".$del_id."'  limit 0,1 ");
	$data=$query_hao->fetch_array();
	if(isset($data['name']) && !empty($data['name'])){
		$del_id=$data['name'];
		$mysqli->query("update hao set status='del'  where id='".$data['id']."'  ");
	}
	$mysqli->query("insert into hao(name) values(".$del_id.") ");
	header("Location: admin.php");
	exit;
}

$query=$mysqli->query("select type,num from tu limit 0, 100");
$data=array();
while ($list=$query->fetch_array()){
	$data[$list['type']] =$list['num'];
}
?><!DOCTYPE html>
<html lang="zh-cn">
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>周生生</title>
	<meta name="keywords" content="" />
	<meta name="description" content="" />
	<link rel="shortcut icon" href="http://wechat.levi.com.cn/attachment/images/global/wechat.jpg" />
	<link href="./resource/css/bootstrap.min.css" rel="stylesheet">
	<link href="./resource/css/font-awesome.min.css" rel="stylesheet">
	<link href="./resource/css/common.css" rel="stylesheet">
	<script>var require = { urlArgs: 'v=2015080715' };</script>
	<script src="./resource/js/require.js"></script>
	<script src="./resource/js/app/config.js"></script>
	<script src="./resource/js/lib/jquery-1.11.1.min.js"></script>
	<!--[if lt IE 9]>
		<script src="./resource/js/html5shiv.min.js"></script>
		<script src="./resource/js/respond.min.js"></script>
	<![endif]-->
	<script type="text/javascript">
	if(navigator.appName == 'Microsoft Internet Explorer'){
		if(navigator.userAgent.indexOf("MSIE 5.0")>0 || navigator.userAgent.indexOf("MSIE 6.0")>0 || navigator.userAgent.indexOf("MSIE 7.0")>0) {
			alert('您使用的 IE 浏览器版本过低, 推荐使用 Chrome 浏览器或 IE8 及以上版本浏览器.');
		}
	}
	</script>
</head>
<body>	

   <div class="navbar navbar-static-top" role="navigation">
	    <br />
		<div class="container-fluid"><img style="position:relative;margin:0px auto;display:block;" src="logo.png"></div>
	</div>
   
	
	<div class="container-fluid">
				<div class="row">
										<div class="col-xs-12 col-sm-3 col-lg-2 big-menu">
										<div class="panel panel-default">
						<div class="panel-heading">
							<h4 class="panel-title">基本功能</h4>
							<a class="panel-collapse" data-toggle="collapse" href="#frame-0">
								<i class="fa fa-chevron-circle-down"></i>
							</a>
						</div>
						<?php include_once 'menua.php'; ?>
					</div>
							
									
									</div>
				<div class="col-xs-12 col-sm-9 col-lg-10">
										<script type="text/javascript">
	require(['bootstrap.switch'], function($){
		$(function(){
			$(':checkbox').bootstrapSwitch();
			$(':checkbox').on('switchChange.bootstrapSwitch', function(e, state){
				var rids = [];
				$(':checkbox:checked').each(function(){
					rids.push($(this).val());
				});
				$.post(location.href, {'rids': rids.toString()}, function(data){
					console.dir(data)
				});
			});
		});
	});
</script>
<div class="panel panel-default">
	<div class="table-responsive panel-body">
	   &nbsp;    用户 实物图片 点击数量统计<br /><br />
		<table class="table table-hover">
			<thead class="navbar-inner">
			    <tr>
				    <th style="width:20px;">图1 <img width="50" height="50" src="../images/p3-1.png"></th>
					<th style="width:20px;">图2 <img width="50" height="50" src="../images/p3-2.png"></th>
					<th style="width:20px;">图3 <img width="50" height="50" src="../images/p3-3.png"></th>
					<th style="width:20px;">图4 <img width="50" height="50" src="../images/p3-4.png"></th>
					<th style="width:20px;">图5 <img width="50" height="50" src="../images/p3-5.png"></th>
					<th style="width:20px;">图6 <img width="50" height="50" src="../images/p3-6.png"></th>
					<th style="width:20px;">图7 <img width="50" height="50" src="../images/p3-7.png"></th>
					<th style="width:20px;">图8 <img width="50" height="50" src="../images/p3-8.png"></th>
					<th style="width:20px;">图9 <img width="50" height="50" src="../images/p3-9.png"></th>
				</tr>
			</thead>
			<tbody>
			   <tr>
					<td style="text-align:center;"><?php echo (int)$data['t1'] ?></td>
					<td style="text-align:center;"><?php echo (int)$data['t2'] ?></td>
					<td style="text-align:center;"><?php echo (int)$data['t3'] ?></td>
					<td style="text-align:center;"><?php echo (int)$data['t4'] ?></td>
					<td style="text-align:center;"><?php echo (int)$data['t5'] ?></td>
					<td style="text-align:center;"><?php echo (int)$data['t6'] ?></td>
					<td style="text-align:center;"><?php echo (int)$data['t7'] ?></td>
					<td style="text-align:center;"><?php echo (int)$data['t8'] ?></td>
					<td style="text-align:center;"><?php echo (int)$data['t9'] ?></td>
					
				</tr>
			
			
			</tbody>
		</table>
	</div>
</div>




			</div>
		</div>
	</div>
	
	<script>require(['bootstrap']);</script>
	
</body>
</html>
